package server;

import utils.ProtocolHeaderUtil;

import java.io.IOException;

public class LucasServlet extends  HttpServlet{
    @Override
    public void doGet(Request request, Response response) throws InterruptedException {
        String doGetStr="<h1>do the get method</h1>";
//        Thread.sleep(100000);

        doGetStr = ProtocolHeaderUtil.getHeader200(doGetStr.length())+doGetStr;
        try {
            response.output(doGetStr);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void doPost(Request request, Response response) {
        String doPost="<h1>do the post method</h1>";
        doPost = ProtocolHeaderUtil.getHeader200(doPost.length())+doPost;
        try {
            response.output(doPost);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void init() {

    }

    @Override
    public void destory() {

    }
}
